import 'package:dio/dio.dart';

import 'HttpManager.dart';
import 'UrlPath.dart';

///
/// 对应项目中业务开发时候的调用接口
///
class Api {
  
  /// 示例请求
  static loginOther(Map<String, dynamic> param) {
    return HttpManager.getInstance().get(UrlPath.baseUrl, params: param);
  }

  /// App检测升级
  static updateApp(String baseUrl, Map<String, dynamic> param) {
    return HttpManager.getInstance(baseUrl: baseUrl).get(UrlPath.firImAppId, params: param);
  }

  /// app配置列表[单对象]
  static postAppSetInfo(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.appSetInfo, params: param);
  }

  /// 多文件上传接口
  static uploadFiles(List<MultipartFile> multipartFiles, {ProgressCallback? onSendProgress}) {
    return HttpManager.getInstance().uploadFiles(UrlPath.uploadFiles, multipartFiles: multipartFiles, onSendProgress: onSendProgress);
  }

  /// 文件下载
  /// urlPath   下载路径
  /// fileName  文件名称
  static downLoad(String urlPath, String fileName) {
    return HttpManager.getInstance(baseUrl: "").downLoad(urlPath, fileName);
  }


  //=================================== 分片上传 ========================================
  /// 获取文件上传和分片信息
  static getChunkFile(Map<String, dynamic> param, {bool withLoading = true}) {
    return HttpManager.getInstance().post(UrlPath.getChunkFile, params: param, withLoading: withLoading);
  }

  /// 保存文件片信息
  static saveChunkFile(Map<String, dynamic> param, {bool withLoading = true}) {
    return HttpManager.getInstance().post(UrlPath.saveChunkFile, params: param, withLoading: withLoading);
  }

  /// 上传分片
  static upload(FormData formData, {bool withLoading = false}) {
    return HttpManager.getInstance().upload(UrlPath.upload, formData: formData, withLoading: withLoading);
  }

  /// 合并分片
  static merge(Map<String, dynamic> param, {bool withLoading = true}) {
    return HttpManager.getInstance().post(UrlPath.merge, params: param, withLoading: withLoading);
  }


  //=================================== 登录 ========================================
  /// 登录
  static login(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.login, params: param);
  }

  /// 获取短信验证码
  static sendSignCodeByAliyun(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.sendSignCodeByAliyun, params: param);
  }

  /// 修改密码接口
  static updateLoginPassword(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.updateLoginPassword, params: param);
  }

  /// 更新用户头像
  static updateUserAvatar(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.updateUserAvatar, params: param);
  }


  // ======================================== 消息 ===============================================
  /// 获取消息列表
  static postListAppNotice(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.listAppNotice, params: param);
  }

  /// 获取消息未读数量
  static getNoticeReadCount(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.getNoticeReadCount, params: param);
  }

  /// 更新消息已读
  static updateNoticeRead(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.updateNoticeRead, params: param);
  }

  /// 更新消息全部已读
  static updateAllNoticeRead(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.updateAllNoticeRead, params: param);
  }

  /// 获取内容详情
  static postArticle(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.getArticle, params: param);
  }


  //=================================== 要闻 ========================================
  /// 门户-获取内容分页信息
  static postListArticle(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.listArticle, params: param);
  }

  /// 门户-获取内容详情
  static postArticleDetail(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.articleDetail, params: param, withLoading: false);
  }

  /// 获取效能动态
  static listDynamic(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.listDynamic, params: param);
  }

  /// 搜索
  static listAppArticleBasic(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.listAppArticleBasic, params: param);
  }


  //=================================== 报名 ========================================
  /// 获取报名列表
  static postListSign(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.listSign, params: param);
  }
  /// 立即报名
  static postGoCollectSign(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.goCollectSign, params: param);
  }
  /// 获取报名信息
  static postCollectDetail(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.getCollectDetail, params: param);
  }

  /// 获取值班日历详情
  static postListCalendarDetail(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.listCalendarDetail, params: param);
  }

  /// 窗口值班报名
  static postGoScheduleSign(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.goScheduleSign, params: param);
  }

  /// 获取值班日期报名列表
  static postListSignRecord(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.listSignRecord, params: param);
  }

  /// 窗口值班 取消报名
  static postCancelScheduleSign(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.cancelScheduleSign, params: param);
  }

  //=================================== 采集 ========================================
  /// 获取任务采集列表
  static postListProblemCollect(Map<String, dynamic> param){
    return HttpManager.getInstance().post(UrlPath.listProblemCollect, params: param);
  }
  /// 保存问题填报信息
  static postSaveProblemSubmit(Map<String, dynamic> param){
    return HttpManager.getInstance().post(UrlPath.saveProblemSubmit, params: param);
  }

  /// 确认问题
  static postConfirmTask(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.confirmStatus, params: param);
  }
  /// 完成填报
  static postSubmitConfirmTask(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.submitConfirmTask, params: param);
  }
  /// 删除问题填报接口
  static postDeleteProblem(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.deleteProblem, params: param);
  }


  //=================================== 采集2 ========================================
  /// 获取任务详情
  static getTaskDetail(Map<String, dynamic> param){
    return HttpManager.getInstance().post(UrlPath.getTaskDetail, params: param);
  }

  //=================================== 采集2.1 ========================================
  /// 获取问题清单类型列表[2.0]
  static listProblemReportType(Map<String, dynamic> param){
    return HttpManager.getInstance().post(UrlPath.listProblemReportType, params: param);
  }
  /// 根据问题清单获取上报问题列表[2.0]
  static listProblemByCode(Map<String, dynamic> param){
    return HttpManager.getInstance().post(UrlPath.listProblemByCode, params: param);
  }

  /// 获取厅局下所有科室（下级机构查询 非分厅）
  static listJxOrgByPid(Map<String, dynamic> param){
    return HttpManager.getInstance().post(UrlPath.listJxOrgByPid, params: param);
  }

  //=================================== 我的 ========================================
  /// 获取我的报名列表
  static postListSelfSignCollect(Map<String, dynamic> param){
    return HttpManager.getInstance().post(UrlPath.listSelfSignCollect, params: param);
  }
  /// 获取个人中心数据
  static postCenterData(Map<String, dynamic> param){
    return HttpManager.getInstance().post(UrlPath.centerData, params: param);
  }
  /// 意见反馈
  static saveSuggestionSubmit(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.saveSuggestionSubmit, params: param);
  }


  //=================================== 设备 ========================================
  /// 设备确认授权
  static authDevice(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.authDevice, params: param);
  }
  /// 设备确认授权
  static checkAuthDevice(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.checkAuthDevice, params: param);
  }


  //=================================== 积分 ========================================
  /// 获取积分明细
  static listIntegralInfo(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.listIntegralInfo, params: param);
  }


  //=================================== 随手拍 ========================================
  /// 保存随手拍填报信息
  static saveOtherProblemSubmit(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.saveOtherProblemSubmit, params: param);
  }
  /// 获取随手拍问题数据列表
  static listOtherProblem(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.listOtherProblem, params: param);
  }
  /// 获取随手拍问题详情
  static getOtherProblem(Map<String, dynamic> param) {
    return HttpManager.getInstance().post(UrlPath.getOtherProblem, params: param);
  }

}
